package com.awaken.content.service.impl;

import com.awaken.content.models.dto.UserDTO;
import com.awaken.content.models.request.UserRequest;
import com.awaken.content.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;

/**
 * 用户服务实现类
 *
 * @author awaken-lin
 */
@Slf4j
@Service
public class UserServiceImpl implements UserService {

    @Override
    public UserDTO register(UserRequest request) {
        log.info("用户注册: {}", request);
        UserDTO user = new UserDTO();
        user.setId(1L);
        user.setUsername(request.getUsername());
        user.setCreateTime(LocalDateTime.now());
        return user;
    }

    @Override
    public UserDTO login(UserRequest request) {
        log.info("用户登录: {}", request);
        UserDTO user = new UserDTO();
        user.setId(1L);
        user.setUsername(request.getUsername());
        user.setCreateTime(LocalDateTime.now());
        return user;
    }

    @Override
    public UserDTO getUserById(Long id) {
        log.info("获取用户信息: {}", id);
        UserDTO user = new UserDTO();
        user.setId(id);
        user.setUsername("示例用户");
        user.setCreateTime(LocalDateTime.now());
        return user;
    }

    @Override
    public List<UserDTO> getAllUsers() {
        log.info("获取所有用户列表");
        List<UserDTO> users = new ArrayList<>();
        UserDTO user = new UserDTO();
        user.setId(1L);
        user.setUsername("示例用户");
        user.setCreateTime(LocalDateTime.now());
        users.add(user);
        return users;
    }
}